<%@ page import="edu.session.User" %>
<%@ page import="java.util.*" %><%--
  Created by IntelliJ IDEA.
  User: 16690
  Date: 2020/9/16
  Time: 16:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    User user = new User();
    user.setUsername("张三");
    user.setPassword("123123");
    pageContext.setAttribute("user01", user);

    User user2 = new User();
    user2.setUsername("李四");
    user2.setPassword("234234");
    request.setAttribute("user01", user2);

    User user3 = new User();
    user3.setUsername("王五");
    user3.setPassword("234234");
    session.setAttribute("user01", user3);

    User user4 = new User();
    user4.setUsername("古一");
    user4.setPassword("234234");
    application.setAttribute("user01", user4);

    List<User> list = new ArrayList<>();
    Collections.addAll(list,user,user2,user3,user4);
    request.setAttribute("list",list);

%>
${user01.password}<!--123123-->
${user01.username}<!--张三-->
<hr>
${requestScope.get("user01")}<!--张三-->
<hr>
${sessionScope.get("user01")}
<hr>
${applicationScope.get("user01")}
<hr>
${pageScope.get("user01")}
<hr>

${not empty list}
${list.get(0).username}
</body>
</html>
